#include <stdio.h>
#include <math.h>

int main(void) {
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        int result = 0, bit = 1;
        for (int i = 0; i < 10; i++) {
            int bit_a = a / bit % 10;
            int bit_b = b / bit % 10;
            int bit_result = (bit_a + bit_b) % 10;
            result += bit_result * bit;
            bit *= 10;
        }
        printf("%d\n", result);
    }
    return 0;
}
